﻿// -------------------------------------------------------------------------
//    @FileName         :    NFWorldPlayerIDHashTable.h
//    @Author           :    gaoyi
//    @Date             :   2023-07-10
//    @Email			:    445267987@qq.com
//    @Module           :    NFWorldPlayerIDHashTable.h
//
// -------------------------------------------------------------------------

#pragma once

#include <proto_cs.pb.h>

#include "NFComm/NFObjCommon/NFObject.h"
#include "NFLogicCommon/NFLogicShmTypeDefines.h"
#include "NFLogicCommon/NFCommDefine.h"
#include <vector>
#include <NFComm/NFShmStl/NFShmHashMap.h>



class NFPlayer;

class NFPlayerMgr : public NF_OBJECT_GLOBAL_TEMPLATE_MACRO(NFPlayerMgr, EOT_LOGIC_PLAYER_MGR_ID, NFObject)
public:
    NFPlayerMgr();

    virtual ~NFPlayerMgr();

    int CreateInit();

    int ResumeInit();

public:
    virtual int OnTimer(int timeId, int callcount) override;

public:
    NFPlayer *GetPlayer(uint64_t cid);

    NFPlayer *CreatePlayer(uint64_t cid);

    int DeletePlayer(NFPlayer *pPlayer);

public:
    int DayTick();

    int DailyOtherLogicTick();

    int WeekTick();

    int MonthTick();
public:
    int SecTick();
    int FiveSecTick();
    int MinuteTick();
    int FiveMinuteTick();
    int HourTick();
private:
    int m_dayTickTimer;
    int m_dayOtherTickTimer;
    int m_weekTickTimer;
    int m_monthTickTimer;
    int m_secTickTimer;
    int m_fiveSecTickTimer;
    int m_minuteTickTimer;
    int m_fiveMinuteTickTimer;
    int m_hourTickTimer;
private:
    NFShmHashMap<tagAccountAndID, int, GAMESVR_MAX_PLAYER_NUM_IN_HASH_TABLE> m_oAccountHash;
};
